import React from 'react'
import PropTypes from 'prop-types'

export default function Field(props) {
  return (
    <div>
      <label>{props.label}</label>
      <input
        type={props.type}
        value={props.value}
        onChange={(evt) => props.onChangeEvent(evt.target.value)}
      />
    </div>
  )
}

Field.defaultProps = {
  label: '',
  type: 'text',
  value: '',
  onChangeEvent: (index) => {},
}

Field.propTypes = {
  label: PropTypes.string,
  type: PropTypes.string,
  value: PropTypes.any,
  onChangeEvent: PropTypes.func,
}
